import type { FormField, TableColumn } from '@/components'
import { ref } from 'vue'
import { sorgList } from '@/api/spotCheck/spotCheck'
sorgList().then((res) => {
  fields.value.forEach((k) => {
    if (k.key === 'id') {
      k.attrs.options = res.data.map((i) => ({
        value: i.sorgInfoId,
        label: i.orgName,
        types: i.types
      }))
    }
  })
})
export const fields = ref([
  {
    tag: 'el-select-v2',
    key: 'id',
    label: '社会组织名称',
    placeholder: '请选择',
    attrs: {
      filterable: true,
      clearable: true,
      options: []
    }
  },
  {
    tag: 'MSelect',
    key: 'state',
    label: '处理状态',
    placeholder: '请选择',
    attrs: {
      options: [
        {
          value: 0,
          label: '待处理'
        },
        {
          value: 1,
          label: '已处理'
        }
      ]
    }
  }
])

export const columns: TableColumn[] = [
  {
    key: 'sorgName',
    label: '社会组织名称'
  },
  {
    key: 'createTime',
    label: '创建时间'
  },
  {
    key: 'riskDetail',
    label: '风险详情'
  },
  {
    key: 'rect',
    label: '整改要求'
  },
  {
    key: 'handleSituation',
    label: '处理情况'
  },
  {
    key: '状态',
    label: '状态',
    slot: true
  }
]
